<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .father {
            width: 200px;
            height: 300px;
            background-color: pink;
        }
        
        .son {
            width: 100px;
            height: 100px;
            background-color: skyblue;
        }
    </style>
</head>

<div id="app">
    {{msg}}
    <hr>
    <!-- 阻止冒泡 -->
    <div class="father" @click.self="father">
        <div class="son" @click="son">

            <a @click.stop.prevent="handel" href="https//www.baidu.com">跳轉百度</a
        </div>

    </div>
    <!-- <div class="father" @click="father">
        <div class="son" @click.stop="son"></div>

    </div> -->

    <!-- 阻止默認行為 -->
    <a @click.prevent href="https//www.baidu.com">跳轉百度</a>




        </div>
        <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.7.14/vue.min.js"></script>
        <script>
            const vu = new Vue({
                el: "#app",
                data: {
                    msg: 'hello vue',


                },
                methods: {
                    father() {
                        console.log('father');
                    },
                    son() {
                        console.log('son')
                    },
                    handel() {}

                },
            })
        </script>






        </body>

</html>